<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>渠道商品管理</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../../res/plugins/chosen/css/chosen.css" rel="stylesheet">
    <link href="../../res/plugins/channel/css/yfChannel.css" rel="stylesheet">
    <script src="../../res/js/comm.js"></script>
    <script src="../../res/plugins/validate/jquery.validate.min.js"></script>
    <script src="../../res/plugins/validate/messages_zh.min.js"></script>
    <script src="../../res/plugins/ajaxsubmit/ajaxsubmit-0.1.4.js"></script>
    <script src="../../res/plugins/chosen/js/chosen.jquery.js"></script>
    <script src="../../res/plugins/channel/yfChannel.js"></script>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="panel panel-info">
        <div class="panel-heading"><i class="fa fa-info-circle"></i> 渠道商品列表</div>
        <div class="panel-body">
            <div class="ibox-query">
                <form id="queryForm" method="post" class="form-horizontal">
                    <input name="orderStatus" type="hidden">
                    <div class="form-group">
						<label class="col-sm-1 control-label">渠&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;道</label>
						<div class="col-md-2">
							<input placeholder="渠道" id="channelCode" name="channelCode1" class="form-control" type="text">
						</div>
						<input type="hidden" name="goodsCodes" id="goodsCodes">
						<input type="hidden" name="channelCodes" id="channelCodes">
                        <label class="col-sm-1 control-label">商品编码</label>
                        <div class="col-sm-2"><input name="goodsCode" id="searchGoodsCode" class="form-control" type="text"></div>

                        <label class="col-sm-1 control-label">商品名称</label>
                        <div class="col-sm-2"><input name="channelGoodsName" class="form-control" type="text"></div>
                        <label class="col-sm-1 control-label" style="width: 58px;">状态</label>
                        <div class="col-sm-1">
                            <select name="channelGoodsStatus" class="form-control">
                              <option value="">全部</option>
                              <option value="ON_LINE">上架</option>
                              <option value="OFF_LINE">下架</option>
                            </select>
                        </div>
                        <label class="col-sm-1 control-label" style="width: 58px;">库存</label>
                        <div class="col-sm-1">
                            <select name="usefulStock" class="form-control">
                                <option value="">全部</option>
                                <option value="GT">大于0</option>
                                <option value="EQ">等于0</option>
                                <option value="LT">小于0</option>
                            </select>
                        </div>
                     </div>
                     <div class="form-group">
                        <label class="col-md-1 control-label">价格来源</label>
                        <div class="col-sm-1">
                            <select name="priceSourceType" class="form-control">
                                <option value="">--请选择--</option>
                                <option value="RETAIL_PRICE">零售价</option>
                                <option value="MEMBER_PRICE">会员价</option>
                                <option value="SELF_PRICE">自主定价</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-12" style="text-align: right">
	                       <button style="margin-left: 30px;" class="btn btn-info" onclick='search()'
	                               type="button"><i class="glyphicon glyphicon-search"></i> 查询
	                       </button>
	                       <button style="margin-left: 10px;" class="btn btn-info" onclick="resetForm()" type="button"><i class="glyphicon glyphicon-share-alt"></i> 重置  </button>
	                   </div>
                    </div>
                </form>
            </div>

            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="bars pull-left">
                        <p>
                            <button type="button" name="orderStatus" value="PAYMENT_WAITING"   class="btn btn-sm btn-info" onclick="updateBatchGoodsStatus('ON_LINE')"><i></i> 上架</button>
                            <button type="button" name="orderStatus" value="APPROVE_WAITING" class="btn btn-sm btn-success" onclick="updateBatchGoodsStatus('OFF_LINE')"><i></i> 下架</button>
                            <button type="button" name="orderStatus" value="DELIVERY_WAITING" class="btn btn-sm btn-primary" onclick="deleteChannelGoods()"><i></i> 删除</button>
                            <!-- <button type="button" name="orderStatus" value="SHIPMENT_WAITING"  class="btn btn-sm btn-warning" onclick="showImportExcel()"><i></i> 批量导入</button> -->
                            <button type="button" name="orderStatus" value="SHIPMENT_WAITING"  class="btn btn-sm btn-warning" onclick="showImportDeleteExcel()"><i></i> 批量检索导入</button>
                        </p>
                    </div>

                    <table id="table" data-show-export="true">
                        <thead>
                        <tr>
                            <th data-checkbox="true" ></th>
                            <th data-field="id" data-visible="false"></th>
                            <th data-align="center" data-formatter="showControllFormat">操作</th>
                            <th data-align="center" data-field="goodsCode">商品编码</th>
                            <th data-align="center" data-field="goodsName">商品名称</th>
                            <th data-align="center" data-field="channelCode">渠道编码</th>
                            <th data-align="center" data-field="categoryNames">商品类目名称</th>
                            <th data-align="center" data-field="channelGoodsName">渠道商品名称</th>
                            <th data-align="center" data-field="guidePrice">指导价</th>
                            <th data-align="center" data-field="channelPrice">渠道价</th>
                            <th data-align="center" data-field="stock">可销售库存</th>
                            <th data-align="center" data-formatter="showFormatStatus" data-field="status">状态</th>
                            <th data-align="center" data-field="categoryCode" data-formatter='formatCode' data-visible="false">类目编码</th>
                            <th data-align="center" data-field="recommendIndex" data-visible="false">推荐指数</th>
                            <th data-align="center" data-field="goodsMark" data-visible="false">商品角标</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<!--模板定义-->
<script type="text/html" id="editFormTemplate">

<form id="editForm" class="form-horizontal" name="editForm">
	<input type="hidden" name="id" value="{{d.id}}" />
	<input type="hidden" name="channelCode" value="{{d.channelCode}}" />
    <input type="hidden" name="goodsCode" value="{{d.goodsCode}}" />
   <div class="col-md-12" style="margin-top: 20px;height:400px;width:700px;">
   <div class="form-group">
	<label class="col-sm-2 control-label">商品编码</label>
       <div class="col-sm-4"><input class="form-control" type="text" value="{{d.goodsCode ? d.goodsCode : ''}}" readonly="readonly"></div>

       <label class="col-sm-2 control-label">商品名称</label>
       <div class="col-sm-4"><input class="form-control" type="text" value="{{d.goodsName ? d.goodsName : ''}}" readonly="readonly"></div>
   </div>
   <div class="form-group">
       <label class="col-sm-2 control-label">渠道商品编码</label>
       <div class="col-sm-4"><input name="channelGoodsCode" class="form-control" type="text" value="{{d.channelGoodsCode ? d.channelGoodsCode : ''}}"></div>

       <label class="col-sm-2 control-label">渠道商品名称</label>
       <div class="col-sm-4"><input name="channelGoodsName" class="form-control" type="text" value="{{d.channelGoodsName ? d.channelGoodsName : ''}}"></div>
   </div>
	<div class="form-group">
       <label class="col-sm-2 control-label">指导价</label>
       <div class="col-sm-4"><input name="guidePrice" class="form-control" type="text" value="{{d.guidePrice ? d.guidePrice : ''}}"></div>

       <label class="col-sm-2 control-label">渠道价</label>
       <div class="col-sm-4"><input name="channelPrice" class="form-control" type="text" value="{{d.channelPrice ? d.channelPrice : ''}}"></div>
   </div>
	<div class="form-group">
       <label class="col-sm-2 control-label">推荐指数</label>
       <div class="col-sm-4">
		<input name="recommendIndex" class="form-control" type="text" value="{{d.recommendIndex ? d.recommendIndex : ''}}">
 		<span class="help-block m-b-none"><i class="fa fa-info-circle"></i>数值越小，指数越高</span>
	   </div>

       <label class="col-sm-2 control-label">商品角标</label>
       <div class="col-sm-4"><input name="goodsMark" class="form-control" type="text" value="{{d.goodsMark ? d.goodsMark : ''}}"></div>
   </div>
	<div class="form-group">
       <label class="col-sm-2 control-label">备注</label>
       <div class="col-sm-10"><textarea rows="3" cols="10" name="remark" class="form-control" type="text">{{d.remark ? d.remark : ''}}</textarea></div>
   </div>
 </div>
</form>
</script>

<div id="import-form" class="modal fade" aria-hidden="true"
		style="display: none;">
		<div class="modal-dialog" style="width: 500px;">
			<div class="modal-content animated bounceInTop">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title">渠道商品导入</h4>
				</div>
				<div class="modal-body" style="padding-top: 0px;">
					<form class="form-horizontal" name="uploadForm" id="uploadForm" enctype="multipart/form-data" method="post">
						<div style="width: 450px; height: 260px;padding: 5px 30px;">
              <div class="row" style="text-align: left;">
                  <div class="col-sm-6">
                      <a href="https://img.yifengx.com/zt/templet/商品上下架导入模板-ecp.xlsx" style="text-decoration: underline;"><span style="color: blue;">模板下载</span></a>
                  </div>
              </div>
							<div class="row" style="padding-top: 15px;">
								<div class="col-md-3" style="width: auto">
									<label class="control-label">渠&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;道</label>
								</div>
								<div class="col-md-6">
									<input placeholder="渠道" id="channelCodeImport" name="channelCode2" class="form-control" type="text">
								</div>
							 </div>
							 <input type="hidden" name="channelCodes" id="channelCodesImport">

						    <div class="row" style="padding-top: 15px;">
						        <label class="col-sm-3" style="padding-top: 8px;">请选择</label>
						        <div class="col-sm-6">
						            <input style="width: 180px; padding-top: 5px;" name="excelFile" type="file" id="excelFileInput"/>
						        </div>
						    </div>

						    <div class="row" style="padding-top: 15px;">
						        <div class="col-sm-3">&nbsp;</div>
						        <div class="col-sm-6">
						            <button class="btn btn-info" type="button" onclick="importExcel()" id="importExcelButton">上传</button>
						        </div>
						    </div>

						    <div class="row" style="padding-top: 30px;">
						        <div class="col-sm-2">&nbsp;</div>
						        <div class="col-sm-10" id="uploadImgResult"></div>
						    </div>
						</div>
					</form>
					</div>
				<div class="modal-footer"
					style="margin: 0 auto; text-align: center;">
					<button class="btn btn-sm btn-default" type="button"
						data-dismiss="modal">
						<strong>取消</strong>
					</button>
				</div>
			</div>
		</div>
	</div>

	<div id="import-delete-form" class="modal fade" aria-hidden="true"
		style="display: none;">
		<div class="modal-dialog" style="width: 500px;">
			<div class="modal-content animated bounceInTop">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title">批量检索导入</h4>
				</div>
				<div class="modal-body" style="padding-top: 0px;">
					<form class="form-horizontal" name="uploadForm" id="uploadForm" enctype="multipart/form-data" method="post">
						<div style="width: 450px; height: 260px;padding: 5px 30px;">
              <div class="row" style="text-align: left;">
                  <div class="col-sm-6">
                      <a href="https://img.yifengx.com/zt/templet/渠道商品批量删除导入模板-ecp.xlsx" style="text-decoration: underline;"><span style="color: blue;">模板下载</span></a>
                  </div>
              </div>
						    <div class="row" style="padding-top: 15px;">
						        <label class="col-sm-3" style="padding-top: 8px;">请选择</label>
						        <div class="col-sm-6">
						            <input style="width: 180px; padding-top: 5px;" name="excelFile" type="file" id="excelDeleteFileInput"/>
						        </div>
						    </div>

						    <div class="row" style="padding-top: 15px;">
						        <div class="col-sm-3">&nbsp;</div>
						        <div class="col-sm-6">
						            <button class="btn btn-info" type="button" onclick="importDeleteExcel()" id="importDeleteExcelButton">上传</button>
						        </div>
						    </div>

						    <div class="row" style="padding-top: 30px;">
						        <div class="col-sm-2">&nbsp;</div>
						        <div class="col-sm-10" id="uploadImgResult"></div>
						    </div>
						</div>
					</form>
					</div>
				<div class="modal-footer"
					style="margin: 0 auto; text-align: center;">
					<button class="btn btn-sm btn-default" type="button"
						data-dismiss="modal">
						<strong>取消</strong>
					</button>
				</div>
			</div>
		</div>
	</div>
</script>
<script src="../../js/goods/channelGoods.js"></script>
<script type="text/javascript" src="../../res/plugins/yifeng/channel.js"></script>
</html>
